package com.demo.juc.async;

import java.util.concurrent.*;

public class FutureMain {

    public static void main(String[] args) throws ExecutionException, InterruptedException {


        //Callable  有返回回调
        ExecutorService executorService = Executors.newCachedThreadPool();
        Future<String> future = executorService.submit(new Callable<String>() {
            @Override
            public String call() throws Exception {
                return "callable test!";
            }
        });

        System.out.println(future.get());
        executorService.shutdown();

    }
}
